﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace select_Adapter
{
    class Program
    {
        static void Main(string[] args)
        {
            SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=sale; User Id=sa; Password=sa");
            SqlDataAdapter adapter = new SqlDataAdapter();
            SqlCommand selCommand = new SqlCommand("select ID, Name from customers", conn);
            adapter.SelectCommand = selCommand;
            DataSet ds = new DataSet();
            adapter.Fill(ds, "customers");
            DataTable dt = ds.Tables["customers"];
            foreach (DataRow row in dt.Rows)
            {
                Console.WriteLine("ID:{0} - Name:{1}", row[0], row[1]);
            }
            conn.Close();

        }
    }
}
